import request from "@/api/request";
import type { SunnyResult } from "@/types/sunnyResult/type";
import type { AxiosPromise } from "axios";

export function listAllResultsApi(): AxiosPromise<SunnyResult[]> {
  return request({
    url: "/sunnyResult",
    method: "get",
  });
}

export function listResultInProjectApi(
  projectId: number
): AxiosPromise<SunnyResult[]> {
  return request({
    url: "/sunnyResult/InProject/" + projectId,
    method: "get",
  });
}

/**查询一条result的结果 */
export function getOneResultApi(id: number): AxiosPromise<SunnyResult> {
  return request({
    url: "/sunnyResult/" + id,
    method: "get",
  });
}

export function deleteResultApi(id: number) {
  return request({
    url: "/sunnyResult/" + id,
    method: "delete",
  });
}

export function listResultDetailOfResultApi(resultId: number) {
  return request({
    url: "/sunnyResult/" + resultId + "/detail",
    method: "get",
  });
}
